package com.project.controller;

import com.project.bean.UserBean;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("user")
public class UserController {
    @RequestMapping("land")
    public String login(String name, String password, UserBean userBean) {
        System.out.println(userBean);
        if ("张三".equals(name) && "123".equals(password)) {
            return "登录成功";
        } else {
            return "登录失败";
        }
    }

    @RequestMapping(value = "add", method = RequestMethod.POST)
    public String add(UserBean userBean) {
        return "添加成功";
    }

    @RequestMapping("del/{userId}")
    public String del(@PathVariable("userId") int id) {
        return "删除ID" + id;
    }

    @RequestMapping("/update")
    public String update(@RequestParam(value = "id",defaultValue = "0") int id){
        return "修改"+id;
    }
}
